package com.hxzon.aixzsecretary.util;

import java.util.Observable;
import java.util.Observer;

public class AixzSensor extends Observable {
	private Object data;
	private Object container;

	public AixzSensor(Object container) {
		this.container = container;
	}

	public void addObserver(Observer observer) {
		super.addObserver(observer);
		System.out.println(container.getClass() + " add observer "
				+ observer.getClass());
	}

	public Object getContainer() {
		return container;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public Object getData() {
		return data;
	}

	public void notifyObservers() {
		super.setChanged();
		super.notifyObservers();
		System.out.println(container.getClass() + " notify and send data "
				+ data);
	}

	// when all observer are same data
	public void notifyObservers(Object data) {
		super.setChanged();
		super.notifyObservers(data);
	}

}
